package com.csweimei.rentmanagementtreasure.tenant.viewModel;

import static com.csweimei.rentmanagementtreasure.base.AppConfig.BUNDLE_KEY;

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.csweimei.rentmanagementtreasure.base.AppConfig;
import com.csweimei.rentmanagementtreasure.http.entity.FollowListBean;
import com.csweimei.rentmanagementtreasure.tenant.ui.act.customer.AddRecordActivity;
import com.csweimei.rentmanagementtreasure.tenant.ui.act.customer.CustomerInfoActivity;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.MultiItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

public class DGJItemVM extends MultiItemViewModel {
    public DGJItemVM(@NonNull BaseViewModel viewModel) {
        super(viewModel);
    }

    public ObservableField<FollowListBean.DataDTO.TobeFollowDTO> info = new ObservableField<>();

    public void setData(FollowListBean.DataDTO.TobeFollowDTO dgjBean) {
        info.set(dgjBean);
    }

    public BindingCommand lookClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            Bundle intent = new Bundle();
            intent.putString(BUNDLE_KEY, info.get().getCustomid() + "");
            intent.putString(AppConfig.BUNDLE_KEY2, "person");
            viewModel.startActivity(CustomerInfoActivity.class, intent);
        }
    });


    public BindingCommand addR = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            Bundle intent = new Bundle();
            intent.putString("id", info.get().getCustomid() + "");
            viewModel.startActivity(AddRecordActivity.class, intent);
        }
    });



}
